package hu.rsc.forbiddenwords.server.persistent;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;

@PersistenceCapable
public class Entry {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;

    @Persistent
    private String word;

    @Persistent
    private Integer count;

    private Key application;

    // Accessors for the fields. JDO doesn't use these, but your application does.

    public Entry(Key application, String word, Integer count) {
	super();
	this.application = application;
	this.word = word;
	if (count == null) {
	    count = 0;
	}
	this.count = count;
    }

    public Key getApplication() {
	return this.application;
    }

    public Integer getCount() {
	return this.count;
    }

    public Key getKey() {
	return this.key;
    }

    public String getWord() {
	return this.word;
    }

    public void setApplication(Key application) {
	this.application = application;
    }

    public void setCount(Integer count) {
	this.count = count;
    }

    public void setKey(Key key) {
	this.key = key;
    }

    public void setWord(String word) {
	this.word = word;
    }

}